<?php

namespace backend\models;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;

use Yii;

/**
 * This is the model class for table "upload_excel".
 *
 * @property integer $id
 * @property string $name
 * @property string $path
 * @property integer $created_at
 */
class Upload extends ActiveRecord
{
    public $file;

    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::className(),
                'attributes' => [
                    ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
                ],
                'value' => time(),
            ]
        ];

    }

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'upload';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [["file"], "file",],
//            [['path'], 'required'],
//            [['created_at'], 'integer'],
//            [['name', 'path'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '序号',
            'name' => '表格名',
            'path' => '上传路径',
            'created_at' => '上传时间',
        ];
    }
}
